package com.ilxqx.framework.system.upload.qiniu.service;

import com.ilxqx.framework.system.config.StaticUploadConfigProperties;
import com.qiniu.common.QiniuException;
import lombok.extern.slf4j.Slf4j;

/**
 * 抽象上传服务类
 * @author venus
 */
@Slf4j
public abstract class AbstractQiNiuUploadService implements QiNiuUploadService, QiNiuBucketManagerService {

	/**
	 * 删除七牛云文件
	 *
	 * @param key 文件标识
	 * @return bool
	 */
	@Override
	public boolean delete(String key) {
		try {
			StaticUploadConfigProperties.bucketManager.delete(StaticUploadConfigProperties.bucket, key);
			return true;
		} catch (QiniuException e) {
			log.error("删除文件[{}]失败，具体原因：{}", key, e);
			return false;
		}
	}

}
